home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 6 / 006.d81 / dos #13 < prev    next >
Encoding:
Text File  |  1984-01-01  |  1.7 KB  |  94 lines

  1.       DOS & DON'TS -- PART 13
  2.       =======================
  3.  
  4.  
  5.  
  6.    To OPEN a sequential file, you use
  7.  
  8. the BASIC OPEN statement.  The Logical
  9.  
  10. File number can be anything from 1 to
  11.  
  12. 127, the Device Number (or First Ad-
  13.  
  14. dress) must be the unit number of the
  15.  
  16. disk drive you are using (ranges from
  17.  
  18. 8 to 11, usually 8).  The Channel #,
  19.  
  20. or Secondary Address can be anything
  21.  
  22. from 2 to 14.  (Remember, 15 is the
  23.  
  24. CEC, and 0 and 1 are set up for LOADs
  25.  
  26. and SAVEs, respectively.)  The file
  27.  
  28. name can be a string of up to 16 of
  29.  
  30. almost any characters, except for
  31.  
  32. Return, comma, colon, asterisk or the
  33.  
  34. question mark.  The file name also
  35.  
  36. cannot begin with a number sign or a
  37.  
  38. dollar sign, although these characters
  39.  
  40. can be used within the file name.
  41.  
  42.  
  43.    If you are OPENing an existing file
  44.  
  45. to be read from, that is all you need.
  46.  
  47. If you are creating a new file and you
  48.  
  49. want to write to it, first be sure to
  50.  
  51. SCRATCH it, then OPEN it with a ',S,W'
  52.  
  53. attached to the name.  This signifies
  54.  
  55. a SEQuential file OPENed for WRITE. If
  56.  
  57. you are OPENing an existing file to
  58.  
  59. add data to the end of it, use the un-
  60.  
  61. documented (at least in the current
  62.  
  63. 1541 manual) ',A' option.  This signi-
  64.  
  65. fies an OPEN for APPEND.  You need to
  66.  
  67. specify the file type only when creat-
  68.  
  69. ing the file.  The mode must be speci-
  70.  
  71. fied if it is not READ (',R').
  72.  
  73.  
  74.    In an actual program, you should
  75.  
  76. OPEN the CEC before OPENing any seq-
  77.  
  78. uential files, and keep it OPEN until
  79.  
  80. the last file has been CLOSED.  This
  81.  
  82. enables the program to detect and act
  83.  
  84. upon the nature of various disk errors
  85.  
  86. that may occur, and to send mainten-
  87.  
  88. ance commands (such as the SCRATCH be-
  89.  
  90. fore creating a file) to the drive.
  91.  
  92.  
  93. ======= Continued in Part 14 =========
  94.